package com.xzm.project.ui.activity

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.xzm.project.R
import com.xzm.project.ui.fragment.tab.FragmentFour
import com.xzm.project.ui.fragment.tab.FragmentOne
import com.xzm.project.ui.fragment.tab.FragmentThree
import com.xzm.project.ui.fragment.tab.FragmentTwo
import com.xzm.project.ui.widget.tab.TabViewChild
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

//    private var tabView: TabView? = null
//    private val text: String? = null


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
//        tabView = findViewById(R.id.tabView) as TabView
        //start add data
        val tabViewChildList = ArrayList<TabViewChild>()
        val tabViewChild01 = TabViewChild(R.drawable.tab01_sel, R.drawable.tab01_unsel,
                "首页", FragmentOne.newInstance("首页"))
        val tabViewChild02 = TabViewChild(R.drawable.tab02_sel, R.drawable.tab02_unsel,
                "分类", FragmentTwo.newInstance("分类"))
        val tabViewChild03 = TabViewChild(R.drawable.tab03_sel, R.drawable.tab03_unsel,
                "目录", FragmentThree.newInstance("目录"))
        val tabViewChild04 = TabViewChild(R.drawable.tab05_sel, R.drawable.tab05_unsel,
                "我的", FragmentFour.newInstance("我的"))
        tabViewChildList.add(tabViewChild01)
        tabViewChildList.add(tabViewChild02)
        tabViewChildList.add(tabViewChild03)
        tabViewChildList.add(tabViewChild04)
        //end add data
        tabView.setTabViewDefaultPosition(0)
        tabView.setTabViewChild(tabViewChildList, supportFragmentManager)
//        tabView.setOnTabChildClickListener { position, imageView, textView -> }
    }
}
